package com.atguigu.blog.user.controller;

import com.atguigu.blog.user.entity.User;
import com.atguigu.blog.user.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/user/{userId}/articles")
    public User findArticleList(@PathVariable("userId") Long id){
        User user = userService.findUserArticleList(id);
        return user;
    }

    @GetMapping("/user/{userId}")
    public User findUserById(@PathVariable("userId") Long id){
        User user = userService.getById(id);
        return user;
    }

}
